home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: simple code, argc, argv, strcmp()
- Date: 06 Feb 1996 22:31:34 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Feb6153134@qcd.lanl.gov>
- References: <11f7cc$17261a.3b3@daprez> <4etj7c$bma@news.iag.net>
- <fcusack-0202961621470001@mudskipper.cac.psu.edu>
- <31177C77.167EB0E7@texas.net>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: Michael Douglass's message of Tue, 06 Feb 1996 10:06:15 -0600
-
- In article <31177C77.167EB0E7@texas.net> Michael Douglass
- <mikedoug@texas.net> writes:
- <snip>
- > > > if (!strcmp(argv[1],"-d") || !strcmp(argv[1],"-e")) {
- > > > Usage();
- > > > }
- > > <snip>
-
- > argv[1] is always guaranteed to exist. It is simply NULL if there were no
- > arguments.
-
- Even if this is so... You still do *not* want to call strcmp with a
- NULL pointer
-
- Grammatical error :-) Even if this `were' so. argc can be zero with
- argv[0] being NULL and argv[1] undefined. This means that even the
- `program name' is not provided.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-